package org.xt.module.api;

import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.QueryResult;
import org.nutz.dao.pager.Pager;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.By;
import org.nutz.mvc.annotation.Filters;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import org.xt.constants.Res;
import org.xt.entity.DataDaChuwei;
import org.xt.entity.DataGangjia;

@IocBean
@At("/api/xiaochuwei")
public class DataXiaochuweiApiModule {
	@Inject
	private Dao dao;
	
	@At("/findByDachuwei")
	@Ok("json")
	public Res list(@Param(value="dachuweiName", df="")String dachuweiName){
		DataDaChuwei dachuwei = dao.fetch(DataDaChuwei.class, Cnd.where("name", "=", dachuweiName));
		dao.fetchLinks(dachuwei, "xiaochuwei");
		return Res.NEW()
				.code(Res.SUCCESS)
				.msg("ok")
				.data(dachuwei);
	}
}
